package com.dit.action.signIn;

import org.springframework.beans.factory.annotation.Autowired;

import com.dit.action.AbstractAction;
import com.dit.entity.UserLogin;
import com.dit.service.UserService;

public class SignUpAction extends AbstractAction {

	private UserLogin userLogin;

	private String confirmPassword;

	@Autowired
	private UserService userService;
	public String viewNewUserSignUpPage(){
		return SUCCESS;
	}

	public String newUserSignUp() {

		if (userLogin.getPassword().equals(confirmPassword)) {
			int status = userService.newUserSignUp(userLogin);
			if (status > 0) {
				return SUCCESS;
			} else {
				return INPUT;
			}
		}

		else {
			return INPUT;
		}
	}

	public UserLogin getUserLogin() {
		return userLogin;
	}

	public void setUserLogin(UserLogin userLogin) {
		this.userLogin = userLogin;
	}

	public String getConfirmPassword() {
		return confirmPassword;
	}

	public void setConfirmPassword(String confirmPassword) {
		this.confirmPassword = confirmPassword;
	}

}
